﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using EvincePayroll.Data;
using EvincePayroll.Logic;
using EvincePayroll.Utility;

namespace Evince.Service
{
    // Start the service and browse to http://<machine_name>:<port>/Service1/help to view the service's generated help page
    // NOTE: By default, a new instance of the service is created for each call; change the InstanceContextMode to Single if you want
    // a single instance of the service to process all calls.	
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    // NOTE: If the service is renamed, remember to update the global.asax.cs file
    public class HomeService
    {

        [WebGet(UriTemplate = "getSatus/{emailId}")]
        public List<AppOptionData> getSatus(string emailId)
        {
            try
            {
                LeaveRequstLogic leaveLogic = new LeaveRequstLogic(emailId);
                return leaveLogic.getStatus(emailId);
            }
            catch (Exception ex)
            {
                LogEngine.Log(ex.Message);
                throw;
            }


        }

        [WebGet(UriTemplate = "GetAppOption/{email},{key}")]
        public List<AppOptionData> GetAppOption(string email, string key)
        {
            try
            {
                EmployeeLogic empLogic = new EmployeeLogic(email);
                return empLogic.GetAppOption(email, key);
            }
            catch (Exception ex)
            {
                LogEngine.Log(ex.Message);
                throw;
            }
        }
    }
}